﻿using DeviceManager.DB;
using DeviceManager.DB.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DeviceManager.Logic
{
    /// <summary>
    /// 数据逻辑管理器
    /// </summary>
    class LoginManager
    {
        private static LoginManager Mng = null;
        public static LoginManager GetMng()
        {
            if (Mng == null)
            {
                Mng = new LoginManager();
            }
            return Mng;
        }


        #region 公共数据区

        /// <summary>
        /// 当前登录的用户
        /// </summary>
        public User LoginUserInfo = null;


        
        #endregion



        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="userPwd"></param>
        /// <returns></returns>
        public bool UserLogin(string userName,string userPwd)
        {
            User user = ManagerDBCtrl.GetMng().UserLogin(userName, userPwd);
            if (user == null)
            {
                return false;
            }
            else
            {
                LoginUserInfo = user;
                return true;
            }
        }
    }
}
